package com.yjt.javatest.utils;

/**
 * 统一返回类错误码枚举
 *
 * @author fengye
 */
public enum ErrorCode {

    OK(200, "成功"),
    INSERT_DATABASE_ERROR(10000,"插入错误"),
    SELECT_DATABASE_ERROR(10001,"查询错误"),
    PARAM_ERROR(10002,"参数错误"),
    NULL_DATA_ERROR(10003,"空数据错误"),
    SERVER_ERROR(20000,"server error"),
    DELETE_TEST_ERROR(40001,"问卷删除失败"),
    DELETE_QUESTION_ERROR(40002,"问题删除失败"),
    NAME_REPEAT(50000,"name repeat"),
    PASSWORD_ERROR(50001, "password error"),
    LOGIN_ERROR(50002, "login error"),
    AUTHORITY_ERROR(60000,"权限错误"),
    USER_TYPE_ERROR(60001,"用户权限不够错误"),
    USER_NOT_EQUAL_ERROR(60002,"用户不对应错误")

    ;


    private int code;
    private String msg;

    private ErrorCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public ErrorCode addSuffix(String suffix){
        this.msg = this.msg + " error:" + suffix;
        return this;
    }

}
